<template>
  <div>
    <basic-table
      :table-title="tableTitle"
      :data-source="dataSource"
      :data-params="dataParams"
      :multiple-table="false"
      class="mt-4"
    >
      <template v-slot:chack="scope">
        <span style="color: #0087FE; cursor: pointer;" @click="changeStatus(scope.row)">
          查看
        </span>
      </template>
    </basic-table>

    <Modal
      :data-source="getConPermitPersons"
      :data-params="params"
      :show="dialogVisible"
      :descriptions-info="info"
      :descriptions-list="descriptionsList"
      :table-title="tableTitle2"
      :show-type="'both'"
      @close="close"
    />
  </div>
</template>
<script>
import BasicTable from '@/components/BasicTable/index.vue'
import Modal from '@/components/Modal/Index'

import { getConstructionPermits, getConPermitDetail, getConPermitPersons } from '@/api/project'

export default {
  name: 'BasicInfos',
  components: { BasicTable, Modal },
  props: {
    projectId: { type: String, default: '' }
  },
  data() {
    return {
      dialogVisible: false,
      dataSource: () => getConstructionPermits,
      dataParams: {},
      tableTitle: [
        {
          label: '数据等级',
          value: 'DataLevel',
          show: true,
          type: 'text'
        },
        {
          label: '省级施工图审查合格书编号',
          value: 'ProvinceBuildPermitsNum',
          show: true,
          type: 'text'
        },
        {
          label: '合同金额（万元）',
          value: 'ContractMoney',
          show: true,
          type: 'text'
        },
        {
          label: '面积（平方米）',
          value: 'Area',
          show: true,
          type: 'text'
        },
        {
          label: '发证日期',
          value: 'ReleaseDate',
          show: true,
          type: 'text'
        },
        {
          label: '施工许可编号',
          value: 'BuildPermitsNum',
          show: true,
          type: 'text'
        },
        {
          label: '详情',
          show: true,
          type: 'slot',
          slot: 'chack'
        }
      ],
      getConPermitPersons: () => getConPermitPersons,
      params: null,
      info: {},
      tableTitle2: [
        {
          label: '企业角色',
          value: 'ComRole',
          show: true,
          type: 'text'
        },
        {
          label: '企业名称',
          value: 'ComName',
          show: true,
          type: 'text'
        },
        {
          label: '统一社会信用代码',
          value: 'ComNum',
          show: true,
          type: 'text'
        },
        {
          label: '人员角色',
          value: 'PerType',
          show: true,
          type: 'text'
        },
        {
          label: '人员姓名',
          value: 'PerName',
          show: true,
          type: 'text'
        },
        {
          label: '身份证号码',
          value: 'IdCard',
          show: true,
          type: 'text'
        }
      ],
      descriptionsList: {
        'ProjectName': '项目名称',
        'BuiPrjName': '工程名称',
        'BuildErlicenceNum': '施工许可证编号',
        'ProvinceBuildNum': '省级施工许可证编号',
        'ProjectCode': '项目代码',
        'ProjectNum': '项目编号',
        'BuildPlanNum': '建设用地规划许可证编号',
        'ProjectPlanNum': '建设工程规划许可证编号',
        'TenderNum': '中标通知书编号',
        'CensorNum': '施工图审查合格书编号',
        'BargainDays': '合同工期（天）',
        'DataLevel': '数据等级',
        'ManagerName': '项目经理',
        'ManagerComName': '项目经理所属单位',
        'SupervisorName': '总监理工程师',
        'SupervisorComName': '总监理工程师所属单位',
        'ContractMoney': '合同金额（万元）',
        'Area': '面积（平方米）',
        'Length': '长度（米）',
        'Span': '跨度（米）',
        'PrjSize': '建设规模',
        'ReleaseDate': '发证日期',
        'CreateDate': '记录登记时间',
        'DataSource': '数据来源'
      }
    }
  },
  created() {
    this.dataParams.projectId = this.projectId
  },
  methods: {
    close(v) {
      this.dialogVisible = v
    },
    //
    changeStatus(v) {
      // 请求详情 info
      this.params = {
        id: v.Id,
        projectId: this.projectId
      }
      // 请求数据
      getConPermitDetail(this.params).then(res => {
        if (res.code === 200) {
          this.dialogVisible = true
          this.info = res.data.detail
        }
      })
    }
  }
}
</script>

<style scoped>

</style>
